import loading from '@/components/xuan-loading/xuan-loading.vue'
import cLabel from "@/components/cat-label/cat-label.vue"
import fromItem from '@/components/from-item/from-item.vue'

export default {
	data() {
		return {
			Inv: 0,
			list: [],
			fileList: [], //文件


			width: '150rpx',
			height: '100rpx',
			shadeShow: false,
			backgroundColor: "transparent",
			themeColor: '#33CCCC',


			totalData: {
				userId: "",
				userName: "",
				companyId: "",
				companyName: "",
				projectId: "",
				projectName: "",
				recordfiles: null,
				fId: "",
				fProjectid: "",
				fProjectname: "",
				fProjectfullname: "",
				fCompanyid: "",
				fCompanyname: "",
				fCompanyfullname: "",
				fCreateuserid: "",
				fCreateusername: "",
				fCreatedate: null,
				fModifyuserid: "",
				fModifydate: null,
				fModifyusername: "",
				fIssueunit: "", //下发指令单位
				fUnittype: "", //单位类型
				fOrdernumber: "", //工作指令编号
				fStartcheckdate: null,
				fStartcheckdates: "", //开始检查日期
				fEndcheckdate: null,
				fEndcheckdates: "", //检查日期结束
				fCheckunit: "", //受检单位1
				fCheckunitid: "", //受检单位id1
				fCheckunit2: "", //受检单位2
				fCheckunit2id: "", //受检单位id2
				fCheckproject: "", //受检项目
				fCheckprojectid: "", //受检项目id
				fProblemdescription: "", //存在的问题概述
				fChangerequirements: "", //整改措施及要求
				fRequesttermdate: null,
				fRequesttermdates: "", //要求整改期限
				fFileurl: "", //附件资料
				fCheckdepartment: "", //检查部门
				fCheckinspectors: "", //检查人员姓名
				fSubsignid1: "", //指定签收人1id
				fSubsignname1: "", //指定签收人1姓名
				// fSubsignid2: "", //指定签收人2id
				// fSubsignname2: "", //指定签收人2姓名
				fCcpeople: "", //抄送人姓名
				fCcpeopleid: "", //抄送人id
				// fCcpeople2: "", //抄送人2姓名
				// fCcpeopleid2: "", //抄送人2id
				fReportid: "", //填报人id'
				fReportname: "", //填报人姓名
				fReportdate: null,
				fReportdates: "", //填报时间
				fSignunit1: "", //受检单位1 签收单位
				fSigndescription1: "", //受检单位1 签收说明
				fSignid1: "", //受检单位1 签收人id
				fSignname1: "", //受检单位1 签收人姓名
				fSigndate1s: "", //受检单位1 签收时间
				// fSignunit2: "", //受检单位2 签收单位
				// fSigndescription2: "", //受检单位2 签收说明
				// fSignid2: "", //受检单位2 签收人id
				// fSignname2: "", //受检单位2 签收人姓名
				// fSigndate2s: "", //受检单位2 签收时间
				fRecheckresult1: "", //受检单位1 复查结果
				fFilenumber1: "", //受检单位1 复查文件编号
				fRecheckdescription1: "", //受检单位1  复查情况说明
				fRecheckfile1: "", //受检单位1 复查相关资料
				fRecheckid1: "", //受检单位1 复查人id
				fRecheckname1: "", //受检单位1 复查人姓名
				fRecheckdate1s: "", //受检单位1 复查完成时间
				// fRecheckresult2: "", //受检单位2 复查结果
				// fFilenumber2: "", //受检单位2 复查文件编号
				// fRecheckdescription2: "", //受检单位2  复查情况说明
				// fRecheckfile2: "", //受检单位2 复查相关资料
				// fRecheckid2: "", //受检单位2 复查人id
				// fRecheckname2: "", //受检单位2 复查人姓名
				// fRecheckdate2s: "", //受检单位2 复查完成时间
				fStatus: "", //信息状态
				fIsdeleted: "",
			},


			userInfo: null,
			// companyNum: null, //判断用户身份
			// must0: "must",
			// disabled0: false,
			// must1: "must",
			// disabled1: false,
			// must2: "must",
			// disabled2: false,

			options: null, //上个页面传递过来的参数


			//显示隐藏
			basic: 1, //基本信息
			close: 1, //受检单位签收
			//显示隐藏

		};
	},



	onReady() {},

	onLoad(options) {
		var that = this;
		uni.getStorage({ //监督检查方式
			key: 'userInfo',
			success: function(res) {
				that.userInfo = JSON.parse(res.data);
				
			}
		});


		that.fileList = [];
		that.options = options;
		that.getDetailData(options.fid);
		// || MP-WEIXIN || H5
		// #ifdef APP-PLUS
		// this.playVideo()

		// #endif
		// #ifdef H5

		// #endif

	},
	onShow() {

	},
	components: {
		loading,
		fromItem
	},

	onUnload() {


	},

	methods: {
		submit() {
			var that = this
			this.Inv = 1

		},
		unsubmit() {
			var that = this
			this.Inv = 0
		},

		//显示隐藏
		downUp(num) {
			if (num == 1) {
				this.basic = 2;
			} else {
				this.basic = 1;
			}
		},

		downUpClose(num) {
			if (num == 1) {
				this.close = 2;
			} else {
				this.close = 1;
			}
		},


		//显示隐藏
		pdfPage(name, url) {
			console.log(name, url);
			var aa = url;
			let links = encodeURIComponent(aa)
			uni.navigateTo({
				url: '/pages/apply/pdf?links=' + links + '&names=' + name,
			})
		},

		// 文件选择回调
		onChange(files) {},

		// 取消回调事件
		treeCancel1(e) {},


		getDetailData(id) {
			var that = this;
			var datas = {
				fId: id,
			}
			that.$http.getWorkOrderExecutionReport2ByFid(datas).then(res => {
				if (res.errcode == 0) {
					that.totalData = res.data.yjQmpMsWrokorderExecutionreport2;

					// 文件
					var file = res.data.fFileurllist;
					file.map((item, index) => {
						that.fileList.push({
							fId: item.fId,
							name: item.fFileName,
							url: item.url
						})
					})
					that.page = true


				} else {
					uni.showToast({
						title: "请求失败",
						icon: 'none',
						duration: 2000
					});
				}

			}, (err) => {
				uni.showToast({
					title: "接口报错",
					icon: 'none',
					duration: 2000
				});
			})




		},

		callback() {}
	}
}
